import {
	createApp
} from 'vue'
import {
	App
} from '../App.vue'
import {
	createRouter,
	createWebHistory
} from 'vue-router'
import Index from '../views/Index.vue'
import BusinessList from '../views/BusinessList.vue'
import BusinessInfo from '../views/BusinessInfo.vue'
import Login from '../views/Login.vue'
import Orders from '../views/Orders.vue'
import UserAddress from '../views/UserAddress.vue'
import Payment from '../views/Payment.vue'
import OrderList from '../views/OrderList.vue'
import AddUserAddress from '../views/AddUserAddress.vue'
import EditUserAddress from '../views/EditUserAddress.vue'
import Register from '../views/Register.vue'
import Discover from '../views/Discover.vue'
import UserInfo from '../views/UserInfo.vue'
import MyAddress from '../views/MyAddress.vue'
import RedBag from '../views/RedBag.vue'
//一次性添加所有组件
const routes = [{
	path: '/',
	name: 'Home',
	component: Index
}, {
	path: '/index',
	name: 'Index',
	component: Index
}, {
	path: '/businessList',
	name: 'BusinessList',
	component: BusinessList
}, {
	path: '/businessInfo',
	name: 'BusinessInfo',
	component: BusinessInfo
}, {
	path: '/login',
	name: 'Login',
	component: Login
}, {
	path: '/orders',
	name: 'Orders',
	component: Orders
}, {
	path: '/userAddress',
	name: 'UserAddress',
	component: UserAddress
}, {
	path: '/payment',
	name: 'Payment',
	component: Payment
}, {
	path: '/orderList',
	name: 'OrderList',
	component: OrderList
}, {
	path: '/addUserAddress',
	name: 'AddUserAddress',
	component: AddUserAddress
}, {
	path: '/editUserAddress',
	name: 'EditUserAddress',
	component: EditUserAddress
}, {
	path: '/register',
	name: 'Register',
	component: Register
}, {
	path: '/discover',
	name: 'Discover',
	component: Discover
},{
	path: '/userInfo',
	name: 'UserInfo',
	component: UserInfo
},{
	path: '/myAddress',
	name: 'MyAddress',
	component: MyAddress
},{
	path: '/redBag',
	name: 'RedBag',
	component: RedBag
}]

//Vue3不用进行重复路由处理
const router = createRouter({
	history: createWebHistory(process.env.BASE_URL),
	routes
})

const app = createApp(App)
//挂载router到app中
app.use(router).mount("#app")

export default router